
import http from '@/api/index.js'
/* 添加标签 lablename */
const addlable = (lablename, id) => {
    return new Promise((resolve, reject) => {
        http.post('/api/lable/addlable', { id, lablename }).then(res => {
            resolve(res)
        })
    })
}
/* 获取标签的数量 */
const getlablecount = () => {
    return new Promise((resolve, reject) => {
        http.get('/api/lable/getlablescount').then(res => {
            resolve(res)
        })
    })
}
/* 搜索标签 data{
    keyword,pageinfo:{ pageIndex, pageSize }，
} */
const searchlable = (data) => {
    return new Promise((resolve, reject) => {
        http.post('/api/lable/searchlable', data).then(res => {
            resolve(res)
        })
    })
}
/* id lable_id 删除标签 */
const deleteLable = (data) => {
    return new Promise((resolve, reject) => {
        http.post('/api/lable/deletelable', data).then(res => {
            resolve(res)
        })
    })
}
/* pageIndex, pageSize   分页获取标签 */
const getlables = (data) => {
    return new Promise((resolve, reject) => {
        return http.get('/api/lable/getlables', { params: data }).then(res => {
            resolve(res)
        })
    })
}
/* 编辑标签 lablename id lable_id */
const editlables = (data) => {
    return new Promise((resolve, reject) => {
        http.post('/api/lable/editlables', data).then(res => {
            resolve(res)
        })
    })
}
/* 批量删除标签 */
const deleteList = (data) => {
    return new Promise((resolve, reject) => {
        http.post('/api/lable/deletelist', data).then(res => {
            resolve(res)
        })
    })
}
/* 一次性全部获取标签 */
const oneTimegetlables = () =>{
    return new Promise((resolve, reject) => {
        http.get('/api/lable/getalllables').then(res=>{
            resolve(res)
        })
    })
}
export {
    addlable,
    getlablecount,
    searchlable,
    deleteLable,
    editlables,
    getlables,
    deleteList,
    oneTimegetlables
}
